import json
import time

import requests
from bs4 import BeautifulSoup
base_url="https://yyjingyan.com/index.php/page/{}/"
ans=[]
num=0
for i in range(100):
    html = requests.get(base_url.format(i)).text
    try:
        ls = BeautifulSoup(html, 'lxml').select(".article-container")
    except:
        continue
    for j in ls:
        ans.append({
            'id':num,
            'text':j.text
        })
        num+=1
        print(j.text)
    time.sleep(0.05)
with open('target.json','w') as f:
    json.dump(ans,f)